<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>节目包管理</title>
	<meta name="decorator" content="default"/>
    <%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<script type="text/javascript">
        $(document).ready(function() {
            var tpl = $("#treeTableTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
            var data = ${fns:toJson(list)}, rootId = "${not empty office.id ? office.id : '0'}";
            addRow("#treeTableList", tpl, data, rootId, true);
            $("#treeTable").treeTable({expandLevel : 5});
        });
        function addRow(list, tpl, data, pid, root){
            for (var i=0; i<data.length; i++){
                var row = data[i];
                if ((${fns:jsGetVal('row.parentId')}) == pid){
                    $(list).append(Mustache.render(tpl, {
                        dict: {
                            type: getDictLabel(${fns:toJson(fns:getDictList('sys_office_type'))}, row.type)
                        }, pid: (root?0:pid), row: row
                    }));
                    addRow(list, tpl, data, row.id);
                }
            }
        };
        function next(){
        	var rowcount = 0;
        	var egId = "";
        	var name = "";
        	 $("#treeTableList").find("input[type='checkbox']").each(function () {

                 if ($(this).prop('checked')) {
                	 egId = $(this).attr("id");
                	 name = $(this).attr("title");
                	 rowcount++;
                 }
             });
        	 if(rowcount > 1){
        		 showTip("<spring:message code='tip.targetRadio'/>");
        		 return;
        	 }
        	 if(rowcount == 0){
        		 showTip("<spring:message code='tip.pleasechoose'/>");
        		 return;
        	 }
        }
      
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/source/eleSourceGroup/"><spring:message code='Program.pack.list'/></a></li>
		<li ><a href="${ctx}/source/eleSourceGroup/form?id=${eleSourceGroup.id}">
            <shiro:hasPermission name="source:eleSourceGroup:edit">
                <c:if test="${not empty eleSourceGroup.id}">
                    <spring:message code="Program.modify"/>
                </c:if>
                <c:if test="${empty eleSourceGroup.id}">
                    <spring:message code="Program.add"/>
                </c:if>
            </shiro:hasPermission>
            <shiro:lacksPermission name="source:eleSourceGroup:edit">
                <spring:message code="Program.info"/>
            </shiro:lacksPermission></a></li>
        <li class="active">
            <a href="${ctx}/source/eleSourceGroup/equipmentlist">
                <spring:message code="Manage.device.lists"/>
            </a>
        </li>
	</ul><br/>
	<sys:message content="${message}"/>
    <table id="treeTable" class="table table-striped table-bordered table-condensed">
        <thead><tr><th><spring:message code='common.organization'/></th>
            <th><spring:message code="common.device.id"/></th>
            <th><spring:message code='device.type'/></th>
            <th><spring:message code='common.resolution'/></th>
            <th><spring:message code="Program.name"/></th>
        </tr>
        </thead>
        <tbody id="treeTableList"></tbody>
    </table>
    <script type="text/template" id="treeTableTpl">//<!--
        <tr id="{{row.id}}" pId="{{pid}}">
            <td>{{row.name}}</td>
            <td>
                <a href="${ctx}/equipment/eleEquipment/form?id={{row.id}}">
                {{row.address}}
                </a>
            </td>
            <td>{{row.email}}</td>
            <td>{{row.fax}}</td>
			 <td>{{row.phone}}</td>
        </tr>//-->
    </script>
</body>
</html>